<template>
	<view class="content">
		<!-- 上传本人正脸 -->
		<block>
			<view v-if="type==5">
			<view class="header1">
				<view style="color: #FFFFFF; font-size: 58rpx; font-weight: 900; margin: 20rpx 20rpx;">请上传本人照片</view>
				<view style="color: #FFA800; margin-left: 20rpx;">作用于登录验证</view>
				<view  style="margin-left: 270rpx; margin-top: 20rpx;">
					<u-upload @on-success="bbb2" @on-uploaded="aaa2" @on-remove="removeFile2" :action="action"
						:auto-upload="true" max-count="1" :show-progress='imgshow2'>
					</u-upload>
					 
				</view>
				<view class="button" @tap="bindLogin(5)">
					<text>下一步</text>
				</view>
			</view>
			</view>
		</block>
		<!-- 提交 -->
		<block v-if="type==4">
			<view class="header">
				<image src="../../static/shilu-login/logo.png"></image>
			</view>
			<view class="list">
				<!-- <view class="list-call">
				<image class="img" src="/static/shilu-login/4.png"></image>
				<input class="sl-input" v-model="username" type="text" maxlength="12" placeholder="昵称" />
			</view> -->
				<view class="list-call">
					<image class="img" src="/static/shilu-login/1.png"></image>
					<input class="sl-input" @blur="phoneIsReg()" v-model="phone" type="number" maxlength="11"
						placeholder="手机号" />
				</view>
				<view class="list-call">
					<image class="img" src="/static/shilu-login/2.png"></image>
					<input class="sl-input" v-model="password" type="text" maxlength="32" placeholder="登录密码"
						:password="!showPassword" />
					<image class="img" :src="showPassword?'/static/shilu-login/op.png':'/static/shilu-login/cl.png'"
						@tap="display"></image>
				</view>
				<view class="list-call">
					<image class="img" src="/static/shilu-login/3.png"></image>
					<input class="sl-input" v-model="code" type="number" maxlength="11" placeholder="验证码" />
					<view class="yzm" :class="{ yzms: second>0 }" @tap="getcode">{{yanzhengma}}</view>
				</view>
			</view>
			<view class="button-login" hover-class="button-hover" @tap="bindLogin(3)">
				<text>下一步</text>
			</view>
			<!-- <view class="agreement">
				<image @tap="agreementSuccess"
					:src="agreement==true?'/static/shilu-login/ty1.png':'/static/shilu-login/ty0.png'"></image>
				<text @tap="agreementSuccess"> 同意</text>
				<navigator url="agreement?id=1" open-type="navigate">《软件用户协议》</navigator>
			</view> -->
		</block>
		<!-- 邀请码 -->
		<block v-if="type==1">
			<view class="box">
				<view class="title">
					邀请码
				</view>
				<view class="txt">
					填写邀请码有福利
				</view>
				<view class="input">
					<input type="text" value="" v-model="topcode" placeholder="输入邀请码" />
				</view>
				<view class="button">
					<text @click="bindLogin(1)">下一步</text>
					<view class="txt1" style="color: #FFFFFF;" @click="next(2)">
						跳过
					</view>
				</view>
			</view>
		</block>
		<!-- 选择性别 -->
		<block v-if="type==2">
			<view class="box1">
				<view class="title">
					选择性别
				</view>
				<view class="lists">
					<view class="list-" @click="toggle('M')" :class="sex=='M'?'show':''">
						<view class="image">
							<image class="img" src="../../static/nv-icon.png" mode=""></image>
						</view>
					</view>
					<view class="list-" @click="toggle('F')" :class="sex=='F'?'show':''">
						<view class="image">
							<image class="img" src="../../static/nan-icon.png" mode=""></image>
						</view>
					</view>
				</view>
				<view class="lists">
					<view class="list1">
						男士
					</view>
					<view class="list1">
						女士
					</view>
				</view>
				<view class="button" @tap="bindLogin(2)">
					<text>下一步</text>
				</view>
			</view>
		</block>
		<!-- 完善资料 -->
		<block v-if="type==3">
			<view class="box" style="padding-bottom: 30rpx;">
				<view class="title">
					个人信息
				</view>
				<view class="txt">
					完善个人信息，更加有机会吸引ta哦
				</view>
				<view v-if="sex=='F'">
					<u-steps 
					:list="numList" 
					:current="current" 
					active-color='#FFA800'>
					</u-steps>
					<view v-if="current==0">
						<view class="head-img" style="margin-top: 20rpx;">
							<u-upload @on-success="bbb" @on-uploaded="aaa" @on-remove="removeFile" :action="action"
								:auto-upload="true" max-count="1" :show-progress='imgshow'>
							</u-upload>
						</view>
						<view style="color: #ff6164;margin: 0 auto;line-height: 80rpx; width: 100%; text-align: center;">请上传本人照片做头像</view>
						<view class="input" style="margin-top: 10rpx;">
							
							<input type="text" maxlength="8" value="" v-model="nickName" placeholder="请输入昵称" />
						</view>
						<view class="input">
							
							<input type="number" value="" v-model="age" placeholder="请输入年龄" />
						</view>
						<view class="input"  @click="show=true">
							
							<input type="text" value="" placeholder="请选择地区"  v-model="address"
								:disabled='true' />
						</view>
						<view style="text-align: center;" >
							<!-- <u-icon
							 name="arrow-right" 
							 color='#FFA800' 
							 size="100rpx"
							 style="border: 1rpx solid #FFA800; border-radius: 100rpx; padding:20rpx ;"
							 >
							 </u-icon> -->
							 <button class="button" @click="go(current)">下一步</button>
						</view>
						
					</view>
					<view v-if="current==1">
						<view class="input" style="margin-top: 20rpx;">
							
							<input type="text" value="" v-model="hight" placeholder="请输入身高" />
						</view>
						<view class="input" >
							
							<input type="text" value="" placeholder="请输入体重" v-model="weight" />
						</view>
						<view class="input" >
							
							<input type="text" value="" placeholder="请输入职业" v-model="arr.profession" />
						</view>
						<view class="input" >
							<input type="text" value="" placeholder="输入您的个人简介" style="height: 200rpx; margin-top: 100rpx;" v-model="arr.synopsis"/>
						</view>
						<view style="text-align: center; " >
							<button class="button" @click="go(current)" style="margin-top: 140rpx;">下一步</button>
						</view>
						
					</view>
					<view v-if="current==2">
						<view class="uni-form-item uni-column , input" style="margin-top: 20rpx;">
							<picker @change="bindPickerChange" :range="array">	<!-- @change用于获取下拉框改变的值，:range用于循环遍历array数组将数组内容循环 -->
								<label style="font-size: 50rpx;">身材：</label>
								<label style="font-size: 50rpx;">{{array[index]}}</label>		<!-- 循环array数组index为索引 -->
							</picker>
						</view>
						<view class="uni-form-item uni-column , input" >
							<picker @change="bindPickerChange">	<!-- @change用于获取下拉框改变的值，:range用于循环遍历array数组将数组内容循环 -->
								<label style="font-size: 50rpx;">情感状态：</label>
								<label style="font-size: 50rpx;">{{arr.single}}</label>		<!-- 循环array数组index为索引 -->
							</picker>
						</view>
						<view class="uni-form-item uni-column , input" >
							<picker @change="bindPickerChange">	<!-- @change用于获取下拉框改变的值，:range用于循环遍历array数组将数组内容循环 -->
								<label style="font-size: 50rpx;">孩子：</label>
								<label style="font-size: 50rpx;">{{arr.son}}</label>		<!-- 循环array数组index为索引 -->
							</picker>
						</view>
						<view class="uni-form-item uni-column , input" >
							<picker @change="bindPickerChange1" :range="array1">	<!-- @change用于获取下拉框改变的值，:range用于循环遍历array数组将数组内容循环 -->
								<label style="font-size: 50rpx;">学历：</label>
								<label style="font-size: 50rpx;">{{array1[index1]}}</label>		<!-- 循环array数组index为索引 -->
							</picker>
						</view>
						<view class="uni-form-item uni-column , input" >
							<picker @change="bindPickerChange2" :range="array2">	<!-- @change用于获取下拉框改变的值，:range用于循环遍历array数组将数组内容循环 -->
								<label style="font-size: 50rpx;">收入：</label>
								<label style="font-size: 50rpx;">{{array2[index2]}}</label>		<!-- 循环array数组index为索引 -->
							</picker>
						</view>
						<view class="uni-form-item uni-column , input" >
							<picker @change="bindPickerChange3" :range="array3">	<!-- @change用于获取下拉框改变的值，:range用于循环遍历array数组将数组内容循环 -->
								<label style="font-size: 50rpx;">吸烟：</label>
								<label style="font-size: 50rpx;">{{array3[index3]}}</label>		<!-- 循环array数组index为索引 -->
							</picker>
						</view>
						<view class="uni-form-item uni-column , input" >
							<picker @change="bindPickerChange4" :range="array4">	<!-- @change用于获取下拉框改变的值，:range用于循环遍历array数组将数组内容循环 -->
								<label style="font-size: 50rpx;">喝酒：</label>
								<label style="font-size: 50rpx;">{{array4[index4]}}</label>		<!-- 循环array数组index为索引 -->
							</picker>
						</view>
						<view style="text-align: center; " >
							<button class="button" @click="go(current)" style="margin-top: 140rpx;">下一步</button>
						</view>
						
					</view>
					<view v-if="current==3">
						<view style=" color: #FFFFFF; width: 90%; margin: 0 auto;">
							<view style="font-size: 60rpx;margin-top: 20rpx;">
								添加联系方式
							</view>
							<view style="font-size: 20rpx;">
								我们会保护你的隐私，联系方式只展示给审核人员和付费后的vip男生
							</view>
						</view>
						<view class="input" style="margin-top: 10rpx;">
							<input type="text" value="" v-model="wx" placeholder="请输入联系方式" />
						</view>
						<view style="margin-left: 250rpx;">
							<u-upload style="margin-top: 20rpx;"@on-success="bbb1" @on-uploaded="aaa1" @on-remove="removeFile1" :action="action"
								:auto-upload="true" max-count="1" :show-progress='imgshow1'>
							</u-upload>
						</view>
						<view style=" color: #ff6699; width: 90%; margin: 0 auto; text-align: center;">
							<view style="font-size: 30rpx;margin-top: 20rpx;">
								请上传与上方微信匹配的微信二维码以便客服核实
							</view>
							<view style="font-size: 30rpx;">
								匹配不通过将不会通过哦~
							</view>
						</view>
						<view style="text-align: center; margin-top: 20rpx;" >
							<view class="button" @click="bindLogin(4)">
								<text>下一步</text>
							</view>
						</view>
					
					</view>
				
				</view>
				<view v-if="sex=='M'">
				    <view class="head-img">
				    	<u-upload @on-success="bbb" @on-uploaded="aaa" @on-remove="removeFile" :action="action"
				    		:auto-upload="true" max-count="1" :show-progress='imgshow'>
				    	</u-upload>
				    	 
				    </view>
				    <view class="input" style="margin-top: 30rpx;">
				    	<view>*</view>
				    	<input type="text" maxlength="8" value="" v-model="nickName" placeholder="请输入昵称" />
				    </view>
				    <view class="input">
				    	<view>*</view>
				    	<input type="number" value="" v-model="age" placeholder="请输入年龄" />
				    </view>
				    <view class="input">
				    	<view>*</view>
				    	<input type="number" value="" v-model="wx" placeholder="请输入手机号" />
				    </view>
					<view class="input"  @click="show=true">
						<view>*</view>
						<input type="text" value="" placeholder="请选择地区"  v-model="address"
							:disabled='true' />
					</view>
					<view style="text-align: center; margin-top: 20rpx;" >
						<view class="button" @click="bindLogin(4)">
							<text>下一步</text>
						</view>
					</view>
				    <!-- <view class="input">
				    	<view>*</view>
				    	<view style="color: #FFFFFF;font-size: 30rpx;">请选择自己的标签吧</view>
				    </view> -->
				    <!-- <view class="input">
				    	<view>
				    		<u-tag :text="i.name" :name="i.name" class="cut" shape="circle" @click="label(i.id)"
				    			:style="i.style" v-for="i in light" />
				    	</view>
				    </view> -->
					
				</view>
				<!-- <view class="head-img">
					<u-upload @on-success="bbb" @on-uploaded="aaa" @on-remove="removeFile" :action="action"
						:auto-upload="true" max-count="1" :show-progress='imgshow'>
					</u-upload>
					<!-- <image class="img" src="../../static/cx.png" mode=""></image> -->
				<!--</view>
				<view class="input" style="margin-top: 30rpx;">
					<view>*</view>
					<input type="text" maxlength="8" value="" v-model="nickName" placeholder="请输入昵称" />
				</view>
				<view class="input">
					<view>*</view>
					<input type="number" value="" v-model="age" placeholder="请输入年龄" />
				</view>
				<view class="input">
					<view>*</view>
					<input type="text" value="" v-model="wx" placeholder="请输入微信号" />
				</view>
				<view class="input">
					<view>*</view>
					<view style="color: #FFFFFF;font-size: 30rpx;">请选择自己的标签吧</view>
				</view>
				<view class="input">
					<view>
						<u-tag :text="i.name" :name="i.name" class="cut" shape="circle" @click="label(i.id)"
							:style="i.style" v-for="i in light" />
					</view>
				</view>
				<view class="input" v-if="sex=='F'">
					<view>*</view>
					<input type="text" value="" v-model="hight" placeholder="请输入身高" />
				</view>
				<view class="input" v-if="sex=='F'">
					<view>*</view>
					<input type="text" value="" placeholder="请输入体重" v-model="weight" />
				</view>
				<view class="input" v-if="sex=='F'" @click="show=true">
					<view>*</view>
					<input type="text" value="" placeholder="请选择地区" v-if="sex=='F'" v-model="address"
						:disabled='true' />
				</view>
				<view class="face" v-if="sex=='F'">
					<view class="image">
						<image class="img" src="../../static/login-face.png" mode="" />
					</view>
					<view class="text">
						点击进行人脸识别
					</view>
				</view> -->
				
			</view>
		</block>
		<u-picker v-model="show" @confirm="datalist" mode="region"> </u-picker>
	</view>
</template>

<script>
	var _this, js;
	import * as api from '@/api/api.js'
	export default {
		onLoad() {
			_this = this;
			// api.request({
			// 	url: '/sms/send',
			// 	method:'POST',
			// 	data: {
			// 		mobile:13783479867,
			// 	},
			// 	dataType: 'json',
			// }).then(res=>{
			// 	console.log(res);
			// })

		},
		onUnload() {
			clearInterval(js)
			this.second = 0;
		},
		data() {
			return {
				phone: '',
				password: '',
				code: '', //验证码
				topcode: '', //邀请码
				nickName: '', //昵称
				age: '', //生日
				hight: '', //身高
				weight: '', //体重
				// profession:'',//职业
				// synopsis:'',//简介
				address: '', //地区
				// stature:'',//身材 
				// single:'单身',//情感状态
				// son:'无',//孩子
				// education:'',//学历
				// income:'',//收入
				// smoking:'',//吸烟
				// liquor:'',//喝酒
				wx: '',  //微信账号
				pic: '',//头像路径
				qr:'',//二维码
				identityPic:'',//人脸照片
				sex: null, //性别 [M:男,F:女]
				agreement: true,
				showPassword: false,
				second: 0,
				type: 1,
				show: false, //地区选择
				action: 'https://xiuqiu.xiuqiu.cc/api/app/file/upload/element',
				// action:"http://192.168.8.100:9310/file/upload/element",
				// l: '',
				imgshow: true,
				imgshow1:true,
				imgshow2:true,
				arr: {
					profession:'',//职业
					synopsis:'',//简介
					stature:'',//身材 
					single:'单身',//情感状态
					son:'无',//孩子
					education:'',//学历
					income:'',//收入
					smoking:'',//吸烟
					liquor:'',//喝酒
				},
				arr1:'',
				// light: [{
				// 		id: 0,
				// 		name: '运动',
				// 		tag: 0,
				// 		style: ' background-color: #FFFFFF; color: #007AFF;'
				// 	},
				// 	{
				// 		id: 1,
				// 		name: '旅行',
				// 		tag: 0,
				// 		style: ' background-color: #FFFFFF; color: #007AFF;'
				// 	},
				// 	{
				// 		id: 2,
				// 		name: '游戏',
				// 		tag: 0,
				// 		style: ' background-color: #FFFFFF; color: #007AFF;'
				// 	},
				// 	{
				// 		id: 3,
				// 		name: '音乐',
				// 		tag: 0,
				// 		style: ' background-color: #FFFFFF; color: #007AFF;'
				// 	}
				// ],
				numList:[
					{name:1},
					{name:2},
					{name:3},
					{name:4}
					],
					current:0,
				province:'',
				city:'',
				area:'',
				array:['--请选择--','健美','匀称','s形','较瘦'],
				index:0,
				array1:['--请选择--','小学','初中','高中','大专','本科','研究生'],
				index1:0,
				array2:['--请选择--','小于10w','10w至30w','30w至50w','50w至100w','100w以上'],
				index2:0,
				array3:['--请选择--','非抽烟者','偶尔抽烟','经常抽烟'],
				index3:0,
				array4:['--请选择--','不喝','社交应酬','爱饮酒'],
				index4:0
			};
		},
		computed: {
			yanzhengma() {
				if (this.second == 0) {
					return '获取验证码';
				} else {
					if (this.second < 10) {
						return '重新获取0' + this.second;
					} else {
						return '重新获取' + this.second;
					}
				}
			}
		},
		onUnload() {
			this.clear()
		},
		methods: {
			// 注册下拉框
			bindPickerChange: function(e) {		//改变的事件名
				
				//console.log('picker发送选择改变，携带值为', e.target.value)   用于输出改变索引值
				this.index = e.target.value			//将数组改变索引赋给定义的index变量
				this.arr.stature=this.array[this.index]		//将array【改变索引】的值赋给定义的jg变量
				
				console.log(this.arr.stature)		//输出获取的籍贯值，例如：中国
			},
			bindPickerChange1(e){
				this.index1 = e.target.value
				this.arr.education=this.array1[this.index1]
				console.log(this.arr.education)
			},
			bindPickerChange2(e){
				this.index2 = e.target.value
				this.arr.income=this.array2[this.index2]
				console.log(this.arr.income)
			},
			bindPickerChange3(e){
				this.index3 = e.target.value
				this.arr.smoking=this.array3[this.index3]
				console.log(this.arr.smoking)
			},
			bindPickerChange4(e){
				this.index4 = e.target.value
				this.arr.liquor=this.array4[this.index4]
				console.log(this.arr.liquor)
			},
			go(e){
				if(e==0){
					if (this.pic == "") {
						uni.showToast({
							icon: 'none',
							title: '请上传头像'
						});
						return;
					}
					if (this.nickName.length == '') {
						uni.showToast({
							icon: 'none',
							title: '请输入昵称'
						});
						return;
					}
					if (this.age.length == '') {
						uni.showToast({
							icon: 'none',
							title: '请输入年龄'
						});
						return;
					}
					if (this.address == '') {
						uni.showToast({
							icon: 'none',
							title: '请选择地址'
						});
						return;
					}
					this.current=1;
					}
				if(e==1){
					if (this.hight == '') {
						uni.showToast({
							icon: 'none',
							title: '请输入身高'
						});
						return;
					}
					let reg4 = /^(0{1}|[1-9]\d{0,3}|.{0})$/;
					if (reg4.test(this.hight)) {
					
					} else {
						uni.showToast({
							icon: 'none',
							title: '输入身高不符合规范'
						});
					
						return;
					}
					if (this.weight == '') {
						uni.showToast({
							icon: 'none',
							title: '请输入体重'
						});
						return;
					}
					if (this.profession == '') {
						uni.showToast({
							icon: 'none',
							title: '请输入职业'
						});
						return;
					}
					if (this.synopsis == '') {
						uni.showToast({
							icon: 'none',
							title: '请输入简介'
						});
						return;
					}
					this.current=2;
					}
				if(e==2){
					if(this.stature == "--请选择--" || this.stature ==''){
							uni.showToast({
								icon: 'none',
								title: '请选择身材'
							});
							return;
						}
					if(this.education == "--请选择--" || this.education ==''){
							uni.showToast({
								icon: 'none',
								title: '请选择学历'
							});
							return;
						}
					if(this.income == "--请选择--" || this.income ==''){
							uni.showToast({
								icon: 'none',
								title: '请选择收入'
							});
							return;
						}
					if(this.smoking == "--请选择--" || this.smoking ==''){
							uni.showToast({
								icon: 'none',
								title: '吸烟请选择'
							});
							return;
						}
					if(this.liquor == "--请选择--" || this.liquor ==''){
							uni.showToast({
								icon: 'none',
								title: '喝酒请选择'
							});
							return;
						}
					this.current=3;
					console.log(this.current)
					}
				if(e==3){
					// this.current=4;
					}
			},
			label(e) {
				// console.log(e);
				if (e == 0) {

					if (this.light[e].tag == 0) {
						this.light[e].style = 'background-color: #007AFF; color: #FFFFFF;';
						this.light[e].tag = 1;
						console.log(this.light[e].tag);
					} else {
						this.light[e].style = 'background-color: #FFFFFF; color: #007AFF;';
						this.light[e].tag = 0;
						console.log(this.light[e].tag);
					}

				}
				if (e == 1) {

					if (this.light[e].tag == 0) {
						this.light[e].style = 'background-color: #007AFF; color: #FFFFFF;';
						this.light[e].tag = 1;
					} else {
						this.light[e].style = 'background-color: #FFFFFF; color: #007AFF;';
						this.light[e].tag = 0;
					}

				}
				if (e == 2) {

					if (this.light[e].tag == 0) {
						this.light[e].style = 'background-color: #007AFF; color: #FFFFFF;';
						this.light[e].tag = 1;
					} else {
						this.light[e].style = 'background-color: #FFFFFF; color: #007AFF;';
						this.light[e].tag = 0;
					}

				}
				if (e == 3) {

					if (this.light[e].tag == 0) {
						this.light[e].style = 'background-color: #007AFF; color: #FFFFFF;';
						this.light[e].tag = 1;
					} else {
						this.light[e].style = 'background-color: #FFFFFF; color: #007AFF;';
						this.light[e].tag = 0;
					}

				}
			},
			bbb(data, index, lists, name) {
				this.pic = "http://cdn.jiaoyou.zheyousoft.cn/" + data
				console.log(data);
				uni.showToast({
					icon: 'success',
					title: '提交头像成功',
				});
				this.imgshow = false
			},
			removeFile() {},
			aaa() {},
			bbb1(data, index, lists, name) {
				this.qr = "http://cdn.jiaoyou.zheyousoft.cn/" + data
				uni.showToast({
					icon: 'success',
					title: '提交二维码成功',
				});
				this.imgshow1 = false
			},
			removeFile1() {},
			aaa1() {},
			// img(){
			// 	uni.chooseImage({
			// 	    count: 1, //默认9
			// 	    sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
			// 	    sourceType: ['camera','album'], //拍照
			// 	    success: function (res) {
			// 			console.log(res)
			// 			this.identityPic = res
			// 	    },
			// 		fail: function (res) {
			// 			console.log('调取失败')
			// 		}
			// 	});
			// },
			bbb2(data, index, lists, name) {
				this.identityPic = "http://cdn.jiaoyou.zheyousoft.cn/" + data
				uni.showToast({
					icon: 'success',
					title: '提交照片成功',
				});
				this.imgshow2 = false
			},
			removeFile2() {},
			aaa2() {},
			datalist(e) {
				console.log(e)
				this.address = e.province.label + e.city.label + e.area.label;
				this.province = e.province.label
				this.city = e.city.label
				this.area = e.area.label
			},
			// 性别切换 性别 [1:男,0:女]
			toggle(type) {
				this.sex = type
			},
			//
			next(type) {
				this.type = type

			},
			//判断电话号码是否已经注册
			phoneIsReg() {
				var that = this;

			},
			clear() {
				clearInterval(js)
				js = null
				this.second = 0
			},
			display() {
				this.showPassword = !this.showPassword
			},
			agreementSuccess() {
				this.agreement = !this.agreement;
			},
			//获取验证码
			getcode() {
				if (this.phone.length != 11) {
					uni.showToast({
						icon: 'none',
						title: '手机号不正确'
					});
					return;
				}
				if (this.second > 0) {
					return;
				}
				this.second = 60;
				//请求业务
				js = setInterval(function() {
					_this.second--;
					if (_this.second == 0) {
						_this.clear()
					}
				}, 1000)
				api.request({
					url: '/sms/send',
					method: 'POST',
					data: {
						mobile: this.phone,
					},
				}).then(res => {
					console.log(res);
				})


			},
			//注册
			bindLogin(type) {
				// if (this.agreement == false) {
				// 	uni.showToast({
				// 		icon: 'none',
				// 		title: '请先阅读《软件用户协议》'
				// 	});
				// 	return;
				// }
				this.arr1 = JSON.stringify(this.arr)
				// console.log(this.arr1)
				if (type == 3) { 
					console.log(this.arr);
						// console.log(this.yanzhengma);
					if (this.phone.length != 11) {
						uni.showToast({
							icon: 'none',
							title: '手机号格式不正确'
						});
						return;
					}
					if (this.password.length < 6) {
						uni.showToast({
							icon: 'none',
							title: '密码不得低于6位'
						});
						return;
					}
						
					if(this.code.length == ''){
						uni.showToast({
							icon: 'none',
							title: '请输入验证码'
						});
						return;
					}
					if (this.code.length < 6) {
						uni.showToast({
							icon: 'none',
							title: '验证码不正确'
						});
						return;
					}
					
					let {
						code,
						province,
						city,
						area,
						password,
						phone,
						age,
						hight,
						nickName,
						sex,
						weight,
						qr,
						arr1,
						identityPic,
						pic
					} = this
					api.request({
						url: '/user/register',
						data: {
							age: age || '无', //年龄
							area:area || '无',
							birthDate: "2009-11-27", //生日 例如：2009-11-27
							city:city || '无',
							code: code, //验证码
							height: hight || '180', //身高cm
							invitatioCode: '1',
							nickName: nickName, //昵称
							password: password, //密码
							pic: pic, //完整的头像图片路径
							province:province || '无',
							qrCode:qr || '无',//二维码
							sex: sex, //性别 M(男) or F(女)
							userLabels:arr1 || '无',//标签
							userMobile: phone, //手机号
							weight: weight || '120' ,//体重 斤
							identityPic: identityPic || '空'
							//  "age": 18,
							//  "birthDate": "2009-11-27",
							//  "code":111111,
							//  "height": 18,
							//  "nickName": "六篇",
							//  "password": "123456",
							//  "pic": "111",
							//  "sex": "M",
							// "invitatioCode": "111",
							//  "userLabels": "爱玩,游戏",
							//  "userMobile": "17633333326",
							//  "weight": 180,
							//  province:'city',
							//  city:'city',
							//  area:'city'
						},
						method: 'POST',
					}).then(res => {
						console.log(res);
						if (res.statusCode == 200) {
							console.log(res);
							uni.showToast({
								title: '注册成功',
								icon: 'none'
							})
							setTimeout(() => {
								if(this.sex == 'F'){
									uni.navigateTo({
								   url: "/pages/login/tiao"
								})
								}
								else{
									uni.navigateTo({
								   url: "/pages/login/login"
								})
									}
								
							}, 1000)
						}
						if (res.statusCode == 400) {
							uni.showToast({
								title: res.data,
								icon: 'none'
							})
							console.log(1111);
						}


					});
				}
				if (type == 2) {
					if (this.sex == null) {
						uni.showToast({
							icon: 'none',
							title: '性别没有选择'
						});
						return;
					} else if (this.sex !== null) {
						uni.showModal({
							title: '提示',
							content: '性别一经提交，无法更改',
							success: (res) => {
								if (res.confirm) {
									this.type = 3
								} else if (res.cancel) {
									this.sex = this.sex
								}
							}
						});
					}

				}
				if (type == 5) {
					if (this.identityPic == '') {
						uni.showToast({
							icon: 'none',
							title: '请上传照片'
						});
						
						return;
					}
					this.type = 4
					console.log(this.type)
				}
				if (type == 1) {
					if (this.topcode.length != 11) {
						uni.showToast({
							icon: 'none',
							title: '邀请码格式不正确'
						});
						return;
					}
					this.type = type
				}
				if (type == 4) {
					if(this.sex == 'F'){
						if (this.wx == '') {
							uni.showToast({
								icon: 'none',
								title: '请输入微信'
							});
							return;
						}
						if (this.qr == '') {
							uni.showToast({
								icon: 'none',
								title: '请上传二维码'
							});
							return;
						}
						this.type = 5
						}
						if(this.sex == "M"){
							if (this.pic == "") {
								uni.showToast({
									icon: 'none',
									title: '请上传头像'
								});
								return;
							}
							if (this.nickName.length == '') {
								uni.showToast({
									icon: 'none',
									title: '请输入昵称'
								});
								return;
							}
							if (this.age.length == '') {
								uni.showToast({
									icon: 'none',
									title: '请输入年龄'
								});
								return;
							}
							if (this.wx == '') {
								uni.showToast({
									icon: 'none',
									title: '请输入微信'
								});
								return;
							}
							if (this.address == '') {
								uni.showToast({
									icon: 'none',
									title: '请选择地址'
								});
								return;
							}
							this.type = 4
						}
						
					}
			}
		}
	}
</script>

<style lang="scss">
	
	page {
		background-color: #3b3b43;
	}

	.input input {
		color: #FFFFFF;
	}

	.cut {
		margin-left: 20rpx;
	}

	.uni-form-item{
		color: #FFFFFF;
		width: 100rpx;
		height: 100rpx;
    }
	.content {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.header {
		width: 161rpx;
		height: 161rpx;
		background: rgba(63, 205, 235, 1);
		box-shadow: 0rpx 12rpx 13rpx 0rpx rgba(63, 205, 235, 0.47);
		border-radius: 50%;
		margin-top: 30rpx;
		margin-left: auto;
		margin-right: auto;
	}

	.header image {
		width: 161rpx;
		height: 161rpx;
		border-radius: 50%;
	}

	.input {
		display: flex;
		align-items: center;
	}

	.input>view {
		font-size: 40rpx;
		color: #f56c6c;
		padding-left: 18rpx;
		padding-top: 12rpx;
	}

	.input input {
		color: #FFFFFF;
	}

	.list {
		display: flex;
		flex-direction: column;
		padding-top: 50rpx;
		padding-left: 70rpx;
		padding-right: 70rpx;
	}

	.list-call {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		height: 100rpx;
		color: #333333;
		border-bottom: 0.5px solid #e2e2e2;
	}

	.list-call .img {
		width: 40rpx;
		height: 40rpx;
	}

	.list-call .sl-input {
		color: #FFFFFF;
		flex: 1;
		text-align: left;
		font-size: 32rpx;
		margin-left: 16rpx;
	}

	.yzm {
		color: #FF7D13;
		font-size: 24rpx;
		line-height: 64rpx;
		padding-left: 10rpx;
		padding-right: 10rpx;
		width: auto;
		height: 64rpx;
		border: 1rpx solid #FFA800;
		border-radius: 50rpx;
	}

	.yzms {
		color: #999999 !important;
		border: 1rpx solid #999999;
	}

	.button-login {
		color: #FFFFFF;
		font-size: 34rpx;
		width: 470rpx;
		height: 100rpx;
		line-height: 100rpx;
		background: linear-gradient(-90deg, rgba(63, 205, 235, 1), rgba(188, 226, 158, 1));
		box-shadow: 0rpx 0rpx 13rpx 0rpx rgba(164, 217, 228, 0.2);
		border-radius: 50rpx;
		text-align: center;
		margin-left: auto;
		margin-right: auto;
		margin-top: 100rpx;
	}

	.button-hover {
		background: linear-gradient(-90deg, rgba(63, 205, 235, 0.8), rgba(188, 226, 158, 0.8));
	}

	.agreement {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		font-size: 30rpx;
		margin-top: 80rpx;
		color: #FFA800;
		text-align: center;
		height: 40rpx;
		line-height: 40rpx;
	}

	.agreement image {
		width: 40rpx;
		height: 40rpx;
	}

	.box {
		.title {
			color: rgba(16, 16, 16, 100);
			font-size: 72rpx;
			margin-left: 40rpx;
			margin-top: 50rpx;
			color: #FFFFFF;
		}

		.face {
			width: 340rpx;
			height: 90rpx;
			border-radius: 10px;
			text-align: center;
			border: 1px solid rgba(187, 187, 187, 100);
			margin: 0 auto;
			display: flex;

			.image {
				width: 50rpx;
				height: 50rpx;
				margin: auto 0;
				margin-left: 20rpx;
				margin-right: 20rpx;
			}

			.text {
				color: #FFFFFF;
				line-height: 90rpx;
			}

			.img {
				width: 50rpx;
				height: 50rpx;
			}
		}

		.txt {
			font-size: 28rpx;
			margin-left: 40rpx;
			margin-top: 10rpx;
			margin-bottom: 100rpx;
			color: #FFA800;
		}

		.head-img {
			width: 200rpx;
			height: 200rpx;
			margin: 0 auto;

			.img {
				width: 100%;
				height: 100%;
			}
		}

		.input {
			width: 660rpx;
			height: 80rpx;

			font-size: 28rpx;
			text-align: left;
			margin: auto;
			margin-bottom: 30rpx;

			input {

				border-radius: 18rpx;
				background-color: rgba(0, 0, 0, 0.07);
				color: #FFFFFF;
				width: 660rpx;
				height: 80rpx;
				padding-left: 20rpx;
				margin-left: 10rpx;
			}
		}
	}
		.button {
			width: 500rpx;
			height: 80rpx;
			margin: auto;
			line-height: 80rpx;
			border-radius: 20rpx;
			background-color: rgba(0, 103, 198, 100);
			color: rgba(255, 255, 255, 100);
			font-size: 28rpx;
			text-align: center;
			margin-top: 100rpx;
		}
	.box1 {
		.title {
			color: rgba(16, 16, 16, 100);
			font-size: 72rpx;
			margin-left: 40rpx;
			margin-top: 50rpx;
			margin-bottom: 100rpx;
			color: #FFFFFF;
		}


		.lists {
			display: flex;
			justify-content: space-around;

			.list- {
				width: 300rpx;
				height: 500rpx;
				border-radius: 30rpx;
				text-align: center;
				border: 2px solid rgba(187, 187, 187, 100);

				.image {
					width: 240rpx;
					height: 240rpx;
					margin: auto;
					margin-top: 120rpx;

					.img {
						width: 100%;
						height: 100%;
					}
				}
			}

			.show {
				border: 2px solid pink;
			}

			.list1 {
				color: #FFFFFF;
				width: 300rpx;
				text-align: center;
				margin-top: 30rpx;
				font-size: 28rpx;
			}
		}

		.button {
			width: 500rpx;
			height: 80rpx;
			margin: auto;
			line-height: 80rpx;
			border-radius: 20rpx;
			background-color: rgba(0, 103, 198, 100);
			color: rgba(255, 255, 255, 100);
			font-size: 28rpx;
			text-align: center;
			margin-top: 100rpx;
		}
	}
</style>
